#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=8005;
int a[maxn],n,q,x,v,opt,to[maxn];
struct node{int val,id;};
node b[maxn];
bool operator < (const node a,const node b)
{
	return a.val==b.val?a.id<b.id:a.val<b.val;
}
signed main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++)cin>>b[i].val,b[i].id=i,a[i]=b[i].val;
	sort(b+1,b+1+n);
	for(int i=1;i<=n;i++)
		to[b[i].id]=i;
	while(q--)
	{
		cin>>opt;
		if(opt==1)
		{
			cin>>x>>v;
			b[to[x]].val=v;
			a[x]=v;
			if(to[x]==n||b[to[x]].val<b[to[x]-1].val)
				for(int i=to[x];i>=2;i--)
					if(b[i]<b[i-1])swap(b[i],b[i-1]);
			if(to[x]==1||b[to[x]].val>b[to[x]+1].val)
				for(int i=to[x]+1;i<=n;i++)
					if(b[i]<b[i-1])swap(b[i],b[i-1]);
			for(int i=1;i<=n;i++)to[b[i].id]=i;
		}
		if(opt==2)
		{
			cin>>x;
			cout<<to[x]<<endl;
		}
	}
	return 0;
}

